//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.itheima.pinda.authority.entity.auth;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.itheima.pinda.authority.base.entity.SuperEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.time.LocalDateTime;
import javax.validation.constraints.NotNull;

@TableName("pd_auth_user_role")
@ApiModel(
        value = "UserRole",
        description = "角色分配"
)
public class UserRole extends SuperEntity<Long> {
    private static final long serialVersionUID = 1L;
    @ApiModelProperty("角色ID")
    @NotNull(
            message = "角色ID不能为空"
    )
    @TableField("role_id")
    private Long roleId;
    @ApiModelProperty("用户ID")
    @NotNull(
            message = "用户ID不能为空"
    )
    @TableField("user_id")
    private Long userId;

    public UserRole(Long id, Long createUser, LocalDateTime createTime, Long roleId, Long userId) {
        this.id = id;
        this.createUser = createUser;
        this.createTime = createTime;
        this.roleId = roleId;
        this.userId = userId;
    }

    public static UserRole.UserRoleBuilder builder() {
        return new UserRole.UserRoleBuilder();
    }

    public Long getRoleId() {
        return this.roleId;
    }

    public Long getUserId() {
        return this.userId;
    }

    public UserRole setRoleId(final Long roleId) {
        this.roleId = roleId;
        return this;
    }

    public UserRole setUserId(final Long userId) {
        this.userId = userId;
        return this;
    }

    public UserRole() {
    }

    public UserRole(final Long roleId, final Long userId) {
        this.roleId = roleId;
        this.userId = userId;
    }

    public String toString() {
        return "UserRole(super=" + super.toString() + ", roleId=" + this.getRoleId() + ", userId=" + this.getUserId() + ")";
    }

    public boolean equals(final Object o) {
        if (o == this) {
            return true;
        } else if (!(o instanceof UserRole)) {
            return false;
        } else {
            UserRole other = (UserRole)o;
            if (!other.canEqual(this)) {
                return false;
            } else if (!super.equals(o)) {
                return false;
            } else {
                Object this$roleId = this.getRoleId();
                Object other$roleId = other.getRoleId();
                if (this$roleId == null) {
                    if (other$roleId != null) {
                        return false;
                    }
                } else if (!this$roleId.equals(other$roleId)) {
                    return false;
                }

                Object this$userId = this.getUserId();
                Object other$userId = other.getUserId();
                if (this$userId == null) {
                    if (other$userId != null) {
                        return false;
                    }
                } else if (!this$userId.equals(other$userId)) {
                    return false;
                }

                return true;
            }
        }
    }

    protected boolean canEqual(final Object other) {
        return other instanceof UserRole;
    }

    public int hashCode() {
        Boolean PRIME = true;
        int result = super.hashCode();
        Object $roleId = this.getRoleId();
        result = result * 59 + ($roleId == null ? 43 : $roleId.hashCode());
        Object $userId = this.getUserId();
        result = result * 59 + ($userId == null ? 43 : $userId.hashCode());
        return result;
    }

    public static class UserRoleBuilder {
        private Long id;
        private Long createUser;
        private LocalDateTime createTime;
        private Long roleId;
        private Long userId;

        UserRoleBuilder() {
        }

        public UserRole.UserRoleBuilder id(final Long id) {
            this.id = id;
            return this;
        }

        public UserRole.UserRoleBuilder createUser(final Long createUser) {
            this.createUser = createUser;
            return this;
        }

        public UserRole.UserRoleBuilder createTime(final LocalDateTime createTime) {
            this.createTime = createTime;
            return this;
        }

        public UserRole.UserRoleBuilder roleId(final Long roleId) {
            this.roleId = roleId;
            return this;
        }

        public UserRole.UserRoleBuilder userId(final Long userId) {
            this.userId = userId;
            return this;
        }

        public UserRole build() {
            return new UserRole(this.id, this.createUser, this.createTime, this.roleId, this.userId);
        }

        public String toString() {
            return "UserRole.UserRoleBuilder(id=" + this.id + ", createUser=" + this.createUser + ", createTime=" + this.createTime + ", roleId=" + this.roleId + ", userId=" + this.userId + ")";
        }
    }
}
